﻿#region Imports
using System;
using System.Windows.Forms;
using CommonUtilities.Extensions;
using CommonUtilities.Messages;
#endregion Imports

namespace PlaylistAnalyzer.Views
{
    public partial class frmCopyModeSelection : Form
    {
        #region Properties
        public eCopyMode CopyMode { get; private set; }

        public string CustomDirectoryName { get; private set; }
        #endregion Properties

        #region Constructors
        public frmCopyModeSelection()
        {
            this.btnExit = new CommonUtilities.Controls.CUtil_InvisibleExitButton(this);
            InitializeComponent();
        }
        #endregion Constructors

        #region Events
        private void frmCopyMethodSelection_Load(object sender, EventArgs e)
        {
            radAlbum.Checked = true;
        }

        private void btnDone_Click(object sender, EventArgs e)
        {
            if (radCustom.Checked && txtCustom.Text.IsNullOrEmpty())
            { MessageBoxUtil.Show(Program.IsDebug, "Please select a value for custom name\t", "Custom name validation..", MessageBoxButtons.OK, MessageBoxIcon.Error); ; return; }

            CustomDirectoryName = "";
            if (radAlbum.Checked) CopyMode = eCopyMode.Album;
            else if (radArtist.Checked) CopyMode = eCopyMode.Artist;
            else if (radCustom.Checked) { CopyMode = eCopyMode.Custom; CustomDirectoryName = txtCustom.Text; }

            this.DialogResult = DialogResult.OK;
            this.Close();
        }

        private void txtCustom_Enter(object sender, EventArgs e)
        {
            if (!radCustom.Checked) radCustom.Checked = true;
        }

        private void radCustom_CheckedChanged(object sender, EventArgs e)
        {
            if (radCustom.Checked) txtCustom.Focus();
        }
        #endregion Events
    }
}
